home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Frameworks
/
Sprocket Framework DR2
/
Sprocket Framework Interfaces
/
AEFutures.h
next >
Wrap
Text File
|
1996-05-22
|
3KB
|
94 lines
// Sprocket Framework header file
// AEFutures.h
#ifndef _Futures_
#define _Futures_
#ifndef __MIXEDMODE__
#include <MixedMode.h>
#endif
#ifndef __APPLEEVENTS__
#include <AppleEvents.h>
#endif
#ifndef __THREADS__
#include <Threads.h>
#endif
//
// Constants
//
#define kNoMaximumWait (0x7FFFFFFF)
#if 0
//
// Keyword for refCon attribute not documented
// in Inside Macintosh
//
#define keyRefconAttr 'refc'
#endif
//
// Keyword keyAEResetTimerFrequency specifies
// approximately how frequently (in ticks) the
// client would like the server to call AEResetTimer.
// This value is advisory only, and is typically
// one-half of the timeout value.
//
#define keyAEResetTimerFrequencyAttr 'resf'
//
// This is how frequently a server should call
// AEResetTimer if the AppleEvent message doesn't
// contain a 'reset timer frequency' attribute
//
#define kDefaultResetTimerFrequency 30
//
// Values for InitFutures
//
#define kNoSpecialFutureFeatures 0
#define kSpawnHousekeepingThread 0x0001
#define kInstallAsyncPreDispatchHandler 0x0002
#define kAllSpecialFutureFeatures (kSpawnHousekeepingThread | kInstallAsyncPreDispatchHandler)
typedef pascal OSErr (*ThreadCreateProcPtr)(ThreadEntryProcPtr threadEntry, void* threadParam, long handlerRefCon, ThreadID* threadMade);
#ifdef __cplusplus
extern "C" {
#endif
//
// Prototypes for Future functions
//
OSErr InitFutures(ThreadCreateProcPtr threadCreateProc, long initFuturesFlags);
void BlockUntilReal(AppleEvent* reply);
Boolean ReplyArrived(AppleEvent* reply);
void SetReplyTimeoutValue(AppleEvent* reply, long timeoutValue, long maxWaitTime);
void IdleFutures();
OSErr AskForFuture(AppleEvent* ae, AppleEvent* reply, long timeoutValue, long maxWaitTime, AESendMode sendMode, AESendPriority sendPriority);
long GetResetTimerFrequency(AppleEvent* ae);
OSErr ResetTimerIfNecessary(AppleEvent* reply, unsigned long* lastReset, long resetFrequency);
#ifdef __cplusplus
}
//
// Default parameters: for use with C++ compilers
//
inline OSErr InitFutures(ThreadCreateProcPtr threadCreateProc = nil /* kAllSpecialFutureFeatures */) { return InitFutures(threadCreateProc, kAllSpecialFutureFeatures); }
inline OSErr AskForFuture(AppleEvent* ae, AppleEvent* reply, long timeoutValue = kAEDefaultTimeout, long maxWaitTime = kNoMaximumWait, AESendMode sendMode = 0 /* kAENormalPriority */) { return AskForFuture(ae, reply, timeoutValue, maxWaitTime, sendMode, kAENormalPriority); }
#endif
//
// Backwards compatability API
//
#define IsFuture(reply) (!ReplyArrived(reply))
#endif // Futures_h